﻿using HK.Core.Serializable.Attribute;
using HK.Editor.Serializable.Protocol.Drawer;
using UnityEditor;
using UnityEngine;

namespace HK.Editor.Serializable.Drawer
{

    /// <summary>
    /// Drawer - 一般
    /// </summary>
    [CustomPropertyDrawer(typeof(GenericFieldAttribute))]
    public class GenericFieldDrawer : GUIPropertyDrawer<GenericFieldAttribute>, IGenericFieldDrawer
    {
        /// <summary>
        /// 取得Property的高度
        /// </summary>
        /// <param name="iProperty">Property</param>
        /// <param name="iLabel">文本</param>
        /// <returns>Property的高度</returns>
        public override float GetPropertyHeight(SerializedProperty iProperty, GUIContent iLabel)
        {
            TotalHeight = EditorGUI.GetPropertyHeight(iProperty, iLabel, iProperty.isExpanded) + VerticalSpacing;
            return TotalHeight; 
        }
    }
}